1 /*
2 * File: ert_main.c
3 *
4 * Code generated for Simulink model 'Autopilot'.
5 *
6 * Model version : 1.152
7 * Simulink Coder version : 8.5 (R2013b) 08-Aug-2013
8 * C/C++ source code generated on : Mon Feb 03 08:13:57 2014
9 *
10 * Target selection: ert.tlc
11 * Embedded hardware selection: 32-bit Embedded Processor
12 * Code generation objectives: Unspecified
13 * Validation result: Not run
14 */
15
16 #include <stdio.h> /* This ert_main.c example uses printf/fflush */
17 #include "Autopilot.h" /* Model's header file */
18 #include "rtwtypes.h"
19 #include "model_reference_types.h"
20
21 /*
22 * Associating rt_OneStep with a real-time clock or interrupt service routine
23 * is what makes the generated code "real-time". The function rt_OneStep is
24 * always associated with the base rate of the model. Subrates are managed
25 * by the base rate from inside the generated code. Enabling/disabling
26 * interrupts and floating point context switches are target specific. This
27 * example code indicates where these should take place relative to executing
28 * the generated code step function. Overrun behavior should be tailored to
29 * your application needs. This example simply sets an error status in the
30 * real-time model and returns from rt_OneStep.
31 */
32 void rt_OneStep(void)
33 {
34 static boolean_T OverrunFlag = 0;
35
36 /* Disable interrupts here */
37
38 /* Check for overrun */
39 if (OverrunFlag) {
40 return;
41 }
42
43 OverrunFlag = TRUE;
44
45 /* Save FPU context here (if necessary) */
46 /* Re-enable timer or interrupt here */
47 /* Set model inputs here */
48
49 /* Step the model */
50 Autopilot_step();
51
52 /* Get model outputs here */
53
54 /* Indicate task complete */
55 OverrunFlag = FALSE;
56
57 /* Disable interrupts here */
58 /* Restore FPU context here (if necessary) */
59 /* Enable interrupts here */
60 }
61
62 /*
63 * The example "main" function illustrates what is required by your
64 * application code to initialize, execute, and terminate the generated code.
65 * Attaching rt_OneStep to a real-time clock is target specific. This example
66 * illustates how you do this relative to initializing the model.
67 */
68 int_T main(int_T argc, const char *argv[])
69 {
70 /* Unused arguments */
71 (void)(argc);
72 (void)(argv);
73
74 /* Initialize model */
75 Autopilot_initialize();
76
77 /* Attach rt_OneStep to a timer or interrupt service routine with
78 * period 0.025 seconds (the model's base sample time) here. The
79 * call syntax for rt_OneStep is
80 *
81 * rt_OneStep();
82 */
83 printf("Warning: The simulation will run forever. "
84 "Generated ERT main won't simulate model step behavior. "
85 "To change this behavior select the 'MAT-file logging' option.\n");
86 fflush((NULL));
87 while (((void*) 0) == (NULL)) {
88 /* Perform other application tasks here */
89 }
90
91 /* The option 'Suppress error status in real-time model data structure'
92 * is selected, therefore the following code does not need to execute.
93 */
94 #if 0
95
96 /* Disable rt_OneStep() here */
97 #endif
98
99 return 0;
100 }
101
102 /*
103 * File trailer for generated code.
104 *
105 * [EOF]
106 */
107
|